<template>
  <div>
    <section style="height:100%;position:relative">
      <div style="height:100%">
        <iframe
          :src="src"
          frameborder="0"
          id="iframe"
          scrolling="no"
          style="border:none;width:100%;height:612px"
        ></iframe>
      </div>
    </section>
  </div>
</template>

<script>
import { getFormViewList } from '@/api/approval';
import { DevPrefix } from '@/config/cfg.js';

export default {
  data () {
    return {
      src: ''
      //  src="http://192.168.199.109:6868/demo/reportJsp/preview.jsp?rpx=%2Flujian_24_view.rpx&rpxHome=E%3A%2Finspection%2Freport%2Fok%2F2020-02%2Flushi_39&dfxHome=&arg1=1"
    };
  },
  mounted () {
    this.getTableList();
  },
  methods: {
    handleBackClick () {
      this.$router.go(-1);
    },
    async getTableList () {
      // const dataId = this.$route.query.dataid;
      // const type = this.$route.query.type;
      const { type, dataid: dataId } = this.$route.query;
      console.log('上一个页面传过来的是啥0', this.$route.query);

      const data = {
        dataId,
        type
      };
      const resp = await getFormViewList(data);
      // console.log('resp', JSON.stringify(resp, 2, 2));

      const { url, filename, dataId: _dataId, nodeId, filetype, reportId,
        token } = resp.data.data;
      if (filetype == 1) {
        this.src = `${DevPrefix + url}showReportGroup.jsp?rpg=/view/${filename}_zu.rpg&arg1=${_dataId}&pid=${nodeId},${reportId}&token=${token}&tid=1`;
      } else {
        this.src = `${DevPrefix + url}showReport.jsp?rpx=/view/${filename}_view.rpx&arg1=${_dataId}&pid=${nodeId},${reportId}&token=${token}&tid=1`;
      }
      // this.src = `${info.url}showReport.jsp?rpx=/lushi/${info.filename}_view.rpx&arg1=${info.dataId}&pid=${info.nodeId}&token=${info.token}`;
      // this.src = `${info.url}showReport.jsp?rpx=/view/${info.filename}_view.rpx&arg1=${info.dataId}&pid=${info.nodeId}&token=${info.token}`;
    }
  }
};
</script>

<style lang="less" scoped >
.main .content-wrapper {
  overflow-x: hidden;
}
</style>
